package com.zoo.diannaopeijian.controller.component;

import com.zoo.diannaopeijian.comm.filter.FilterUtil;
import com.zoo.diannaopeijian.controller.BaseController;
import com.zoo.diannaopeijian.domain.ComponentParameter;
import com.zoo.diannaopeijian.domain.ComponentParameterDetail;
import com.zoo.diannaopeijian.service.ComponentParameterDetailService;
import com.zoo.diannaopeijian.service.ComponentParameterService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zx583 on 2018-01-15.
 */
@RestController
@RequestMapping("/component/parameter/detail")
public class ComponentParameterDetailController extends BaseController {
    @Resource
    private ComponentParameterDetailService componentParameterDetailService;

    @RequestMapping("/getComponentParameterDetail")
    public List<ComponentParameterDetail> getComponentParameterDetail(ComponentParameterDetail componentParameterDetail) {
        return componentParameterDetailService.getComponentParameterDetail(componentParameterDetail);
    }

    @RequestMapping("/getFilterComponentParameterDetail")
    public List getFilterComponentParameterDetail(ComponentParameterDetail componentParameterDetail) {
        return FilterUtil.getFilterData(componentParameterDetailService.getComponentParameterDetail(componentParameterDetail), "componentparameterdetailid", "componentparameterdetailname");
    }

    @RequestMapping("/addComponentParameterDetail")
    public String addComponentParameterDetail(ComponentParameterDetail componentParameterDetail) {
        return componentParameterDetailService.addComponentParameterDetail(componentParameterDetail) ? success : fail;
    }

    @RequestMapping("/deleteComponentParameterDetail")
    public String deleteComponentParameterDetail(Integer componentparameterdetailid) {
        return componentParameterDetailService.deleteComponentParameterDetail(componentparameterdetailid) ? success : fail;
    }

    @RequestMapping("/updateComponentParameterDetail")
    public String updateComponentParameterDetail(ComponentParameterDetail componentParameterDetail) {
        return componentParameterDetailService.updateComponentParameterDetail(componentParameterDetail) ? success : fail;
    }
}
